﻿<!--#include file="conn.asp"-->
<html>
<head>
    <title>生成全部漫画首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="images/style.css" rel="stylesheet" type="text/css">
</head>
<body>
    <table width="98%" border="0" align="center" cellpadding="8" cellspacing="1" bgcolor="#CCCCCC">
        <tr>
            <td bgcolor="e7e7e7">
                <strong>批量下载图片</strong>
            </td>
        </tr>
        <tr>
            <td bgcolor="#FFFFFF">
                <%
Ds=timer()
set rs=server.createobject("adodb.recordset")
if request("type")="date" then
  if request("Dday")<>"" then
   Ddate=request("Dyear")&"-"&request("Dmonth")&"-"&request("Dday")
   sql="select * from zj where year(adddate) = "&request("Dyear")&" and month(adddate) = "&request("Dmonth")&" and day(adddate) = "&request("Dday")&""
  else
sql="select * from zj where year(adddate) = "&request("Dyear")&" and month(adddate) = "&request("Dmonth")&""
  end if
elseif request("type")="new" then
  if request("newshu")>0 then
   sql="select top "&cint(request("newshu"))&" id,tps from zj order by id desc"
  end if
elseif request("type")="list" then
  sql="select id,tps from zj where id in ("&request("id")&")"
  elseif request("type")="comic" then
  sql="select * from zj where cid = '" & request("id") & "'"
elseif request("type")="id" then
  id=replace(request("id"),",",", ")
  sql="select id,tps from zj where id in("&id&")"
elseif request("type")="all" then
  sql="select id,tps from zj order by id desc"
end if

if sql<>"" then
response.write"<b><font color=""#FF0000"">正在下载图片,请等待......</font></b><span id=showImport></span><IE:Download ID=""oDownload"" STYLE=""behavior:url(#default#download)"" />"
   if request("p")<>"" then
     p=cint(request("p"))
     D=request("D")
   else
     p=1
     D=Ds
   end if
MaxPerPage=1
rs.open sql,conn,1,1
if not rs.eof then
rs.pagesize=30 
mpage=rs.pagecount    
allshu=rs.recordcount  
rs.move  (p-1)*MaxPerPage
do while not rs.eof
i=i+1
zjid=rs("id")
tps=rs("tps")
call MakeHtml()
if i>=MaxPerPage then exit do
rs.movenext
loop
end if
rs.close
Sshu=MaxPerPage*p-MaxPerPage+1
Tshu=Sshu+i-1

if allshu<Sshu then
 set rs=nothing
 conn.close
 set conn=nothing
 response.redirect "pic_downall.asp?type=ok&type2="&request("type")&"&shu="&request("shu")&"&D="&d&"&p="&p+1&""
 response.end
else
 response.write"<meta http-equiv=""refresh"" content=""0;url='pic_downall.asp?type="&request("type")&"&id="&request("id")&"&newshu="&request("newshu")&"&Dyear="&request("Dyear")&"&Dmonth="&request("Dmonth")&"&Dday="&request("Dday")&"&shu="&Tshu&"&D="&D&"&p="&p+1&"'"">"
 response.write"<br><br>正在下载:第 <font color=red>"&Sshu&"</font> 个章节&nbsp;&nbsp;章节ID:"&zjid&" 本章节共<font color=red>"&tps&"</font>个图片 共"&allshu&"个"
end if
Sub MakeHtml()
response.write"<script>function onDownloadDone(downDate){showImport.innerHTML=downDate}oDownload.startDownload('pic_down.asp?id="&rs("id")&"',onDownloadDone)</script>"
end Sub
else
sql="select count(*) from zj"
rs2=conn.execute(sql)
shu=rs2(0)
set rs=nothing
conn.close  
set conn=nothing
if request("type")="ok" then
if request("type2")="id" then
response.write("<script>alert('成功:下载("&request("shu")&")个章节,总费时("&FormatNumber((timer()-request("D")),2)&")秒,完成时间("&Now()&")\n\n点击[确定]返回');history.go(-1)</script>")
response.end
else
if request("shu")<>"" then
htmlshu=request("shu")
else
htmlshu=0
end if
response.write"<br><br>操作成功:下载&nbsp;<font color=""#FF0000"">"&htmlshu&"</font>&nbsp;个章节成功,完成时间"&Now()&""

end if
end if
response.write"</b><ul><li><form name=""zj"" method=""post"" action=""pic_downall.asp?type=date"">按日期下载图片:<select size=""1"" name=""Dyear"">"
for i=2001 to year(date())
response.write"<option value="""&i&""""
if i=year(date()) then
response.write" selected"
end if
response.write">"&i&"</option>"
next
response.write"</select>-<select size=""1"" name=""Dmonth"">"
for i=1 to 12
response.write"<option value="""&i&""""
if i=month(date()) then
response.write" selected"
end if
response.write">"&i&"</option>"
next
response.write"</select>-<select size=""1"" name=""Dday""><option value=""""> </option>"
for i=1 to 31
response.write"<option value="""&i&""""
if i=day(date()) then
response.write" selected"
end if
response.write">"&i&"</option>"
next
response.write"</select> <input name=""change"" class=""submit"" value=""确认"" type=""submit""></form></li><li><form name=pdd method=""post"" action=""pic_downall.asp?type=new"">"
response.write"下载最新<input size=8 name=""newshu"" value=""0"">个图片<input name=""change"" class=""submit"" value=""确认"" type=""submit""></form></li><li>"
response.write"<form name=pid method=""post"" action=""pic_downall.asp?type=all"">下载全部图片<input name=""change"" class=""submit"" value=""确认"" type=""submit""> (共<font color=""#FF0000"">"&shu&"</font>个)</form></li></ul>"
end if%>
            </td>
        </tr>
    </table>
</body>
</html>
